package DBLayer;

import static org.junit.Assert.*;

import java.util.ArrayList;
import java.util.List;

import modelLayer.PartSalesOrder;

import org.junit.After;
import org.junit.Before;
import org.junit.Test;

public class DBPartSalesOrderTest {
	
	private static IFDBPartSalesOrder dbPso = new DBPartSalesOrder();

	@Before
	public void setUp() throws Exception {
	}

	@After
	public void tearDown() throws Exception {
	}
	

	@Test
	public void testGetAllPartOrders() {
		List<PartSalesOrder> list = new ArrayList<PartSalesOrder>();
		
		list = dbPso.getAllPartOrders(true);
		
		if(list.isEmpty())
		{
			p("list is empty");
		}
		else
		{
			p("list PartSalesOrder");
			for(PartSalesOrder p : list)
			{				
				p("#---------------------------------------------------------#");
				p("   partSalesOrder id : "+p.getPartSalesOrderID());
				p("partSalesOrder saoid :"+p.getSalesOrder().getSalesOrderID());
				p("      SalesOrder cid :"+p.getSalesOrder().getCostumer().getCustomerID());
				p("  partSalesOrder pid :"+p.getProduct().getProductID());
				p("        Product name :"+p.getProduct().getName());
				p("#---------------------------------------------------------#");
				p("");
			}
			System.out.println("// end list");
			p("");
			p("");
		}
		
		
	}

	@Test
	public void testFindPartSalesOrder() {
		
		p("");
		p("");
		PartSalesOrder psoObj = dbPso.findPartSalesOrder("612271153", true);
		
		p("partSalesOrder id :"+psoObj.getPartSalesOrderID());
		p("");
		p("");
		
	}

	@Test
	public void testInsertPartSalesOrder() {
		fail("Not yet implemented");
	}

	@Test
	public void testUpdatePartSalesOrder() {
		fail("Not yet implemented");
	}

	@Test
	public void testDelete() {
		fail("Not yet implemented");
	}
	
	public void p(String e)
	{
		System.out.println(e);
	}

}
